package cn.csxw.openchina.ui.adapter;

import android.view.View;
import android.view.ViewGroup;
import android.widget.ImageView;
import android.widget.TextView;

import butterknife.BindView;
import cn.csxw.openchina.R;
import cn.csxw.openchina.base.BaseRecAdapter;
import cn.csxw.openchina.entity.bean.BlogBean;
import cn.csxw.openchina.utils.Global;

/**
 * Created by hp on 2017/1/18.
 */

public class MyBlogAdapter extends BaseRecAdapter<BlogBean> {

    @Override
    protected void onItemClick(View v, int position) {

    }

    @Override
    protected BaseViewHolder getViewHolder(View itemView) {
        return new MyBlogHolder(itemView);
    }

    @Override
    protected View getItemView(ViewGroup parent) {
        View view = Global.inflate(R.layout.fragment_my_blog, parent);
        return view;
    }

    class MyBlogHolder extends BaseViewHolder {
        @BindView(R.id.iv_myblog_type)
        ImageView mIvMyblogType;
        @BindView(R.id.tv_myblog_title)
        TextView mTvMyblogTitle;
        @BindView(R.id.tv_blog_author)
        TextView mTvBlogAuthor;
        @BindView(R.id.iv_myblog_time)
        ImageView mIvMyblogTime;
        @BindView(R.id.tv_myblog_time)
        TextView mTvMyblogTime;
        @BindView(R.id.iv_myblog_message)
        ImageView mIvMyblogMessage;
        @BindView(R.id.tv_blog_message_count)
        TextView mTvBlogMessageCount;

        public MyBlogHolder(View itemView) {
            super(itemView);
        }

        @Override
        public void setData(BlogBean blog, int Position) {
            if(blog==null){
                return;
            }
            mTvMyblogTitle.setText(blog.title);
            mTvBlogAuthor.setText(blog.author);
            mTvMyblogTime.setText(blog.pubDate);
            mTvBlogMessageCount.setText(blog.commentCount + "");
        }
    }
}
